
// 移动端video弹窗
var video = {

    _elTpl: '<div style="display:none;position:fixed;z-index:999999;left:0;right:0;top:0;bottom:0;">' +
              '<a style="display:block;position:absolute;left:0;right:0;top:0;bottom:0;background:rgba(0,0,0,0.75);">' +
                '<div style="position:absolute;width:50px;height:50px;right:10px;top:10px;-webkit-transform:rotate(45deg);">' +
                  '<i style="position:absolute;height:1px;left:0;right:0;top:50%;background:#fff;"></i>' +
                  '<i style="position:absolute;height:1px;left:0;right:0;top:50%;background:#fff;-webkit-transform:rotate(90deg);"></i>' +
                '</div>' +
              '</a>' +
              '<video src="" style="position:absolute;width:100%;left:0;right:0;top:50%;-webkit-transform:translateY(-50%);"></video>' +
            '</div>',

    _popEl    : null,
    _shadowEl : null,
    _videoEl  : null,
    _videoCtl : null,

    open: function(url) {
        this._popEl.show();
        this._videoEl.attr('src', url);
        this._videoCtl.play();
        return this;
    },

    close: function() {
        this._videoCtl.pause();
        this._popEl.hide();
        this._videoEl.attr('src', '');
        return this;
    },

    init: function() {

        var that = this,
            height;

        this._popEl    = $(this._elTpl);
        this._shadowEl = this._popEl.find('a');
        this._videoEl  = this._popEl.find('video');
        this._videoCtl = this._videoEl[0];

        this._shadowEl.click(function(e) {
            that.close();
            return false;
        });

        $('body').append(this._popEl);

        return this;
    }
};

video.init();
